﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model;
using DAL;
using BLL;
namespace Web.Admin
{
    public partial class AuthorityList : System.Web.UI.Page
    {
        private void reload() {
            //获取数据
            List<Authority> objs = AuthorityBll.SelectAll("");
            //设置数据绑定控件的数据源
            this.Repeater1.DataSource = objs;
            //调用显示方法  
            this.Repeater1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            reload();
        }

        protected void LinkButton1_Command(object sender, CommandEventArgs e)
        {
            //获取id
          string id=  e.CommandArgument.ToString();
            //调用业务类的删除反复
         bool r= AuthorityBll.Delete(int.Parse(id));
         if (r)
         {
             reload();
         }
         else {
             Response.Write("<script>alert('删除失败')</script>");
         }

        }

        protected void LinkButton2_Click(object sender, EventArgs e)
        {
            //跳转到添加页面
            Response.Redirect("/Admin/AuthorityAdd.aspx");
        }
      
      
    }
}